package db

import (
	"github.com/jinzhu/gorm"
)

var db *gorm.DB

func Creaete(model interface{}) {
	db.Create(model)
}

func Update(model interface{}) {
	//db.Update(model)
	//db.Model(model).UpdateColumns(model)
	db.Model(model).Update(model)
	First(model)
}

func First(model interface{}) {
	db.First(model)
}

func Delete(model interface{}) {
	db.Update(model)
	db.Delete(model)
}

func Find(model interface{}, opntions ...interface{}) {
	db.Find(model, opntions...)
}
